﻿using Coldairarrow.Entity.BTB_StaffUsers;
using Coldairarrow.IBusiness.BTB_StaffUsers;
using Coldairarrow.Util;
using EFCore.Sharding;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Coldairarrow.Business.BTB_StaffUsers
{
    class BTB_VisitBusiness : BaseBusiness<BTB_Visit>, IBTB_VisitBusiness, ITransientDependency
    {
        public BTB_VisitBusiness(IDbAccessor db)
           : base(db)
        {
        }

        public async Task AddDataAsync(BTB_Visit data)
        {
            HttpContextAccessor context = new HttpContextAccessor();
            BTB_Visit data1 = new BTB_Visit()
            {
                id = GuidHelper.GenerateKey(),
                VisitIP = context.HttpContext?.Connection.RemoteIpAddress.ToString(),
                CreateTime = DateTime.Now,
                Deleted = true,
                PageName = data.PageName,
                Url = data.Url
            };
            await InsertAsync(data1);
        }
    }
}
